import React, {Component} from 'react';
import {Link, withRouter} from 'react-router-dom';
import {Menu, Switch, Layout} from 'antd';
import {
    InsertRowLeftOutlined,
    UserOutlined,
    PartitionOutlined,
    AppstoreOutlined,
    FireOutlined,
    SettingOutlined
} from '@ant-design/icons';

const {SubMenu} = Menu;
const {Sider} = Layout;

import '@src/style/menu.scss'

@withRouter
export default class Menus extends Component {
    state = {};

    render() {
        let activeKey = this.props.history.location.pathname;
        return (
            this.props.history.location.pathname === '/login' ? null :
                <Sider trigger={null} collapsible collapsed={this.props.collapsed}>
                    <Menu
                        defaultSelectedKeys={[activeKey]}
                        defaultOpenKeys={['sub1']}
                        mode='inline'
                        theme='dark'
                    >
                        <SubMenu
                            key="product"
                            title={
                                <>
                                    <AppstoreOutlined />
                                    <span>产品管理</span>
                                </>
                            }
                        >
                            <SubMenu
                                key="sub1"
                                title={
                                    <>
                                        <InsertRowLeftOutlined/>
                                        <span>酒店管理</span>
                                    </>
                                }
                            >
                                <Menu.Item key="/hotel/list">
                                    <Link to='/hotel/list'>酒店列表</Link>
                                </Menu.Item>
                                <Menu.Item key="/hotel/order">
                                    <Link to='/hotel/order'>订单列表</Link>
                                </Menu.Item>
                            </SubMenu>

                            <SubMenu
                                  key="hot_product"
                                  title={
                                      <>
                                          <FireOutlined />
                                          <span>热卖</span>
                                      </>
                                  }
                            >
                                <Menu.Item key="/activity/package">
                                    <Link to='/activity/package'>产品列表</Link>
                                </Menu.Item>
                                <Menu.Item key="/activity/hot/order">
                                    <Link to='/activity/hot/order'>订单列表</Link>
                                </Menu.Item>
                                <Menu.Item key="/activity/hot/refund_reply">
                                    <Link to='/activity/hot/refund_reply'>退款申请</Link>
                                </Menu.Item>
                            </SubMenu>
                        </SubMenu>


                        <SubMenu
                            key="sub2"
                            title={
                                <>
                                    <UserOutlined/>
                                    <span>员工管理</span>
                                </>
                            }
                        >
                            <Menu.Item key="/user/list">
                                <Link to='/user/list'>员工列表</Link>
                            </Menu.Item>
                        </SubMenu>

                        <SubMenu key="sub3" title={
                            <>
                                <PartitionOutlined />
                                <span>资源管理</span>
                            </>
                        }>
                            <Menu.Item key="/assets/images">
                                <Link to='/assets/images'>图片列表</Link>
                            </Menu.Item>
                        </SubMenu>

                        <SubMenu
                            key="company"
                            title={
                                <>
                                    <SettingOutlined/>
                                    <span>用户管理</span>
                                </>
                            }
                        >
                            <Menu.Item key="/company/sup_list">
                                <Link to="/company/sup_list">供应商</Link>
                            </Menu.Item>

                            <Menu.Item key="/company/trade">
                                <Link to="/company/trade">同业</Link>
                            </Menu.Item>


                        </SubMenu>

                        <SubMenu
                            key="conf"
                            title={
                                <>
                                    <SettingOutlined />
                                    <span>平台配置管理</span>
                                </>
                            }
                        >
                            <SubMenu key="hotel_conf" title="酒店配置">
                                <Menu.Item key="/config/list">
                                    <Link to="/config/list">类型配置</Link>
                                </Menu.Item>
                                <Menu.Item key="/config/brand">
                                    <Link to="/config/brand">品牌配置</Link>
                                </Menu.Item>
                                <Menu.Item key="/config/bed">
                                    <Link to="/config/bed">床型配置</Link>
                                </Menu.Item>
                                <Menu.Item key="/config/facilities">
                                    <Link to="/config/facilities">酒店设施</Link>
                                </Menu.Item>
                                <Menu.Item key="/config/services">
                                    <Link to="/config/services">酒店服务</Link>
                                </Menu.Item>
                                <Menu.Item key="/config/star">
                                    <Link to="/config/star">星级配置</Link>
                                </Menu.Item>
                                <Menu.Item key="/config/hot_focus">
                                    <Link to="/config/hot_focus">热门关注</Link>
                                </Menu.Item>
                            </SubMenu>
                            <Menu.Item key="area">
                                <Link to="/config/area">地区配置</Link>
                            </Menu.Item>
                            <Menu.Item key="attraction">
                                <Link to="/config/attraction">景点信息</Link>
                            </Menu.Item>
                            <Menu.Item key="search_city">
                                <Link to="/config/search_city">热门城市搜索配置</Link>
                            </Menu.Item>
                        </SubMenu>
                    </Menu>
                </Sider>
        );
    }
}
